package com.example.film.controller;


import com.example.film.entity.CinemaWeekSell;
import com.example.film.service.CinemaWeekSellService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "影院每周票房信息管理接口")
@CrossOrigin
@RestController
@RequestMapping("cinemaWeek/v1")
public class CinemaWeekSellController {

    @Autowired
    private CinemaWeekSellService cinemaWeekSellService;

    @ApiOperation("每周影院票房信息")
    @GetMapping("/cinemaSell")
    public List<CinemaWeekSell> getCinemaWeekSell(){
        return cinemaWeekSellService.findCinemaWeekSell();
    }

    @ApiOperation("分页查询每周影院票房信息")
    @GetMapping("/cinema")
    public List<CinemaWeekSell> getCinemaWeekSellInfo(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
        return cinemaWeekSellService.findCinemaWeekSellInfo(pageNum, pageSize);
    }

    @ApiOperation("根据周数分页显示每周影院票房信息")
    @GetMapping("/week")
    public List<CinemaWeekSell> getCinemaWeekSellByWeek(@RequestParam(defaultValue = "16") Integer week,@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
        return cinemaWeekSellService.findCinemaWeekSellByWeek(week, pageNum, pageSize);
    }
}
